﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ViewAgentCommision.aspx.cs" 
EnableEventValidation="false" Inherits="reports_ViewAgentCommision" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="Server">
    <title>
        <%=GetGlobalResourceObject("General", "AgentCommisionReport")%>
        - GG-CRM - กล้วยๆ.com - Teledirect Thailand</title>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPageTitle" runat="Server">
    <h1>
        <asp:Label runat="server" Text="<%$Resources:General,AgentCommisionReport%>" ID="lblPageName"></asp:Label></h1>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <asp:Label runat="server" Text="<%$Resources:General,LangOption%>" Visible="false" ID="lblLangOption" />
    
    <div class="bc2">
        <asp:Label runat="server" ID="lblSiteLocation" Text="You are here : " CssClass="bclist"  />
        <asp:SiteMapPath SiteMapProvider="SiteUserSiteMapProvider" ID="smpProvider" runat="server"
            PathSeparator=" : ">
            <PathSeparatorStyle CssClass="bcarrow" />
            <CurrentNodeStyle CssClass="bclist" />
            <NodeStyle CssClass="bclink" />
            <RootNodeStyle CssClass="bclink" />
        </asp:SiteMapPath>
        <div class="clear"></div>
    </div>

    <div class="topdisplay pb10">     

        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="flattable"> 
            <tr>
                <td width="80">
                    <%=GetGlobalResourceObject("CarInsurance", "ReportType")%>
                </td>
                <td>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlReportType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlReportType_SelectedIndexChanged">
                                <asp:ListItem Selected="True" Value="0" Text="<%$Resources:General,Monthly%>"></asp:ListItem>
                            </asp:DropDownList>
                            &nbsp;<asp:Label ID="lblFromDate" runat="server"></asp:Label>
                            <asp:DropDownList ID="ddlDay1" runat="server" ToolTip="Choose Day">
                                <asp:ListItem Value="01">01</asp:ListItem>
                                <asp:ListItem Value="02">02</asp:ListItem>
                                <asp:ListItem Value="03">03</asp:ListItem>
                                <asp:ListItem Value="04">04</asp:ListItem>
                                <asp:ListItem Value="05">05</asp:ListItem>
                                <asp:ListItem Value="06">06</asp:ListItem>
                                <asp:ListItem Value="07">07</asp:ListItem>
                                <asp:ListItem Value="08">08</asp:ListItem>
                                <asp:ListItem Value="09">09</asp:ListItem>
                                <asp:ListItem Value="10">10</asp:ListItem>
                                <asp:ListItem Value="11">11</asp:ListItem>
                                <asp:ListItem Value="12">12</asp:ListItem>
                                <asp:ListItem Value="13">13</asp:ListItem>
                                <asp:ListItem Value="14">14</asp:ListItem>
                                <asp:ListItem Value="15">15</asp:ListItem>
                                <asp:ListItem Value="16">16</asp:ListItem>
                                <asp:ListItem Value="17">17</asp:ListItem>
                                <asp:ListItem Value="18">18</asp:ListItem>
                                <asp:ListItem Value="19">19</asp:ListItem>
                                <asp:ListItem Value="20">20</asp:ListItem>
                                <asp:ListItem Value="21">21</asp:ListItem>
                                <asp:ListItem Value="22">22</asp:ListItem>
                                <asp:ListItem Value="23">23</asp:ListItem>
                                <asp:ListItem Value="24">24</asp:ListItem>
                                <asp:ListItem Value="25">25</asp:ListItem>
                                <asp:ListItem Value="26">26</asp:ListItem>
                                <asp:ListItem Value="27">27</asp:ListItem>
                                <asp:ListItem Value="28">28</asp:ListItem>
                                <asp:ListItem Value="29">29</asp:ListItem>
                                <asp:ListItem Value="30">30</asp:ListItem>
                                <asp:ListItem Value="31">31</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlMonth1" runat="server">
                                <asp:ListItem Value="01">Jan</asp:ListItem>
                                <asp:ListItem Value="02">Feb</asp:ListItem>
                                <asp:ListItem Value="03">Mar</asp:ListItem>
                                <asp:ListItem Value="04">Apr</asp:ListItem>
                                <asp:ListItem Value="05">May</asp:ListItem>
                                <asp:ListItem Value="06">Jun</asp:ListItem>
                                <asp:ListItem Value="07">Jul</asp:ListItem>
                                <asp:ListItem Value="08">Aug</asp:ListItem>
                                <asp:ListItem Value="09">Sep</asp:ListItem>
                                <asp:ListItem Value="10">Oct</asp:ListItem>
                                <asp:ListItem Value="11">Nov</asp:ListItem>
                                <asp:ListItem Value="12">Dec</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlYear1" runat="server">
                                <asp:ListItem Value="2010">2010</asp:ListItem>
                                <asp:ListItem Value="2011">2011</asp:ListItem>
                                <asp:ListItem Value="2012">2012</asp:ListItem>
                                <asp:ListItem Value="2013">2013</asp:ListItem>
                            </asp:DropDownList>
                            &nbsp;
                            <asp:Label ID="lblToDate" runat="server"></asp:Label>
                            <asp:DropDownList ID="ddlDay2" runat="server" ToolTip="Choose Day">
                                <asp:ListItem Value="01">01</asp:ListItem>
                                <asp:ListItem Value="02">02</asp:ListItem>
                                <asp:ListItem Value="03">03</asp:ListItem>
                                <asp:ListItem Value="04">04</asp:ListItem>
                                <asp:ListItem Value="05">05</asp:ListItem>
                                <asp:ListItem Value="06">06</asp:ListItem>
                                <asp:ListItem Value="07">07</asp:ListItem>
                                <asp:ListItem Value="08">08</asp:ListItem>
                                <asp:ListItem Value="09">09</asp:ListItem>
                                <asp:ListItem Value="10">10</asp:ListItem>
                                <asp:ListItem Value="11">11</asp:ListItem>
                                <asp:ListItem Value="12">12</asp:ListItem>
                                <asp:ListItem Value="13">13</asp:ListItem>
                                <asp:ListItem Value="14">14</asp:ListItem>
                                <asp:ListItem Value="15">15</asp:ListItem>
                                <asp:ListItem Value="16">16</asp:ListItem>
                                <asp:ListItem Value="17">17</asp:ListItem>
                                <asp:ListItem Value="18">18</asp:ListItem>
                                <asp:ListItem Value="19">19</asp:ListItem>
                                <asp:ListItem Value="20">20</asp:ListItem>
                                <asp:ListItem Value="21">21</asp:ListItem>
                                <asp:ListItem Value="22">22</asp:ListItem>
                                <asp:ListItem Value="23">23</asp:ListItem>
                                <asp:ListItem Value="24">24</asp:ListItem>
                                <asp:ListItem Value="25">25</asp:ListItem>
                                <asp:ListItem Value="26">26</asp:ListItem>
                                <asp:ListItem Value="27">27</asp:ListItem>
                                <asp:ListItem Value="28">28</asp:ListItem>
                                <asp:ListItem Value="29">29</asp:ListItem>
                                <asp:ListItem Value="30">30</asp:ListItem>
                                <asp:ListItem Value="31">31</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlMonth2" runat="server">
                                <asp:ListItem Value="01">Jan</asp:ListItem>
                                <asp:ListItem Value="02">Feb</asp:ListItem>
                                <asp:ListItem Value="03">Mar</asp:ListItem>
                                <asp:ListItem Value="04">Apr</asp:ListItem>
                                <asp:ListItem Value="05">May</asp:ListItem>
                                <asp:ListItem Value="06">Jun</asp:ListItem>
                                <asp:ListItem Value="07">Jul</asp:ListItem>
                                <asp:ListItem Value="08">Aug</asp:ListItem>
                                <asp:ListItem Value="09">Sep</asp:ListItem>
                                <asp:ListItem Value="10">Oct</asp:ListItem>
                                <asp:ListItem Value="11">Nov</asp:ListItem>
                                <asp:ListItem Value="12">Dec</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlYear2" runat="server">
                                <asp:ListItem Value="2010">2010</asp:ListItem>
                                <asp:ListItem Value="2011">2011</asp:ListItem>
                                <asp:ListItem Value="2012">2012</asp:ListItem>
                                <asp:ListItem Value="2013">2013</asp:ListItem>
                            </asp:DropDownList>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
           <tr>
                <td width="80"><%=GetGlobalResourceObject("General", "Agent")%></td>
                <td>
                    <asp:DropDownList ID="ddlAgentList" runat="server" Width="250px"></asp:DropDownList>
                    <asp:Button ID="ibtSubmit" runat="server" Width="80px" Text="<%$Resources:General,Search%>"
                        OnClick="ibtSubmit_Click" CssClass="blueB ml10" />
                    <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                </td>
            </tr>
        </table>
    </div>

    <div>
        <asp:Label runat="server" ID="lblRecordCount" CssClass="red" />
        <asp:Button runat="server" Visible="false" ID="btnPrint" Text="<%$Resources:General,Print%>"
            OnClientClick="javascript:window.print();return false;" CssClass="greenB ml10"  />
        <asp:Button ID="btnDownLoad" runat="server" Visible="false" Text="<%$Resources:General,GenerateExcel%>"
            OnClick="btnDownLoad_Click" CssClass="greenB ml10"  />
    </div>

    <div class="toggle">
        <div>
            <asp:GridView ID="grvCommisionSummary" runat="server" AllowPaging="false" AutoGenerateColumns="False"
                Width="100%" EmptyDataText="<%$Resources:General,ErrNodata%>" CssClass="sTable bborder"
                GridLines="None" OnRowDataBound="grvCommisionSummary_RowDataBound" AllowSorting="True">
                <Columns>
                    <asp:BoundField DataField="ApplicationDate" HeaderText="<%$Resources:General,Date%>"
                        SortExpression="ApplicationDate" DataFormatString="{0:dd/MM/yyyy hh:mm tt}" />
                    <asp:BoundField DataField="QuoteRefNo" HeaderText="<%$Resources:General,ReferenceNo%>"
                        SortExpression="QuoteRefNo" />
                    <asp:BoundField DataField="AgentName" HeaderText="<%$Resources:General,Broker%>"
                        SortExpression="AgentName" />
                    <asp:BoundField DataField="CustomerName" HeaderText="<%$Resources:General,CustomerName%>"
                        SortExpression="CustomerName" Visible="false" />
                    <asp:BoundField DataField="CompanyName" HeaderText="<%$Resources:General,InsuranceCompany%>"
                        SortExpression="CompanyName" />
                    <asp:BoundField DataField="InsuranceType" HeaderText="<%$Resources:General,InsuranceType%>"
                        SortExpression="InsuranceType" />
                    <asp:BoundField DataField="VMI" HeaderText="<%$Resources:General,RptVMI%>"
                        SortExpression="VMI" DataFormatString="฿{0:#,0.00}" />
                    <asp:BoundField DataField="CMI" HeaderText="<%$Resources:General,RptCMI%>"
                        SortExpression="CMI" DataFormatString="฿{0:#,0.00}" />
                    <asp:BoundField DataField="TotalPremium" HeaderText="<%$Resources:General,TotalPremium%>"
                        SortExpression="TotalPremium" DataFormatString="฿{0:#,0.00}" />
                    <asp:BoundField DataField="CollectedAmount" HeaderText="<%$Resources:General,CollectedAmount%>"
                        SortExpression="CollectedAmount" DataFormatString="฿{0:#,0.00}" />
                </Columns>
                <FooterStyle />
                <PagerStyle />
                <SelectedRowStyle />
                <HeaderStyle />
                <EditRowStyle />
                <AlternatingRowStyle />
                <RowStyle />
            </asp:GridView>
            <div style="float: right; text-align: right; margin-right: 13px; display: none;">
                <asp:TextBox Visible="false" ID="txtHidTotalAmount" runat="server">0</asp:TextBox>
                <div>
                    <asp:Label ID="lblTotalAmount" Font-Bold="true" CssClass="blue" runat="server"></asp:Label></div>
                <div>
                    <asp:Label ID="lblCommision" Font-Bold="true" CssClass="blue" runat="server"></asp:Label></div>
                <div>
                    <asp:Label ID="lblCommisionAmount" Font-Bold="true" CssClass="blue" runat="server"></asp:Label></div>
            </div>
            <div style="float: right; text-align: right; margin-right: 20px;" runat="server"
                visible="false" id="divCommision">
                <div>
                    <asp:Label ID="lblTotalAmountTitle" Font-Bold="true" runat="server"></asp:Label></div>
                <div>
                    <asp:Label ID="lblCommisionTitle" Font-Bold="true" runat="server"></asp:Label></div>
                <div>
                    <asp:Label ID="lblCommisionAmountTitle" Font-Bold="true" runat="server"></asp:Label></div>
            </div>
            <div class="clear"></div>
            <div style="display: none">
                <asp:TextBox ID="txtReportType" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtReportDate1" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtReportDate2" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtReportDate" runat="server"></asp:TextBox>
                <asp:TextBox runat="server" ReadOnly="true" ID="txtAgentId"></asp:TextBox>
                <asp:Label ID="lblContent" runat="server"></asp:Label>
            </div>
        </div>
        <div class="clear"></div>
    </div>

</asp:Content>
